package net.ojbk.study.twobox.beans.form.post;

import net.ojbk.study.twobox.beans.form.InputItem;
import net.ojbk.study.twobox.beans.po.Staff;
import net.ojbk.study.twobox.beans.vo.SelectOption;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: twobox
 * Date: 2019/4/14
 * Time: 17:29
 * Description: No Description
 */
@Component
public class StaffPostForm extends SupperPostForm<Staff> {

    InputItem inputItemPost = new InputItem("职务",
            "postid",
            "0", "select", null);

    public StaffPostForm() throws Exception {
        this.inputItems.add(new InputItem("员工名称", "staffname", "", "text"));
        List<SelectOption> sexList = new ArrayList<>();
        sexList.add(new SelectOption("男", "男"));
        sexList.add(new SelectOption("女", "女"));
        this.inputItems.add(
                new InputItem("性别",
                        "gender",
                        "男", "select",
                        sexList));
        this.inputItems.add(
                new InputItem("生日",
                        "birthday",
                        "1997-04-15", "date"));
        this.inputItems.add(
                new InputItem("入职日期",
                        "ondutydate",
                        "2019-04-15", "date"));
        this.inputItems.add(
                new InputItem("登录名 ",
                        "loginname",
                        "10010", "text"));
        this.inputItems.add(
                new InputItem("登录密码",
                        "loginpwd",
                        "123456", "text"));
        this.inputItems.add(
                new InputItem("员工编号",
                        "staffcode",
                        "999999", "text"));
        this.inputItems.add(inputItemPost);
    }

    @Override
    public List<InputItem> getInputItems() throws Exception {
        inputItemPost.setOther(this.selectOptionUtil.getSelectOptionListByName("post"));
        return super.getInputItems();
    }
}
